package cz.possoft.explorer.context;

/**
 * Immutable class which encapsulate informations about single field.
 * 
 * @author <a href="mailto:mposolda@gmail.com">Marek Posolda</a>
 * @version $Revision$
 */
public class FieldContext<C,T>
{
      private final T fieldName;
      
      private final Class<C> clazz;
      
      private final C value;
      
      private final boolean inspectable;
      
      public FieldContext(T fieldName, C value, boolean inspectable)
      {
         this.fieldName = fieldName;
         this.value = value;
         this.inspectable = inspectable;
         
         // this should be safe if we declare <C> as correct type
         this.clazz = value != null ? (Class<C>)value.getClass() : null;
      }

      public T getFieldName()
      {
         return fieldName;
      }

      public Class<C> getClazz()
      {
         return clazz;
      }

      public C getValue()
      {
         return value;
      }

      public boolean isInspectable()
      {
         return inspectable;
      }            
      
}

